<!--{__NOLAYOUT__}-->
<html><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>考前猜题卷</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/queren.css" />
    <link rel="stylesheet" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/generate.css" />
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/layer_mobile/layer.js"></script>
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/css/layer.css" />
    <script src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/jquery.1.9.1.js"></script>
      <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/rem.js"></script>
    <script type="text/javascript" src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.js"></script>
    <link rel="stylesheet" type="text/css" href="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/js/address_select/mobileSelect.css" />

    <style>
        .addressmone ul li label span{font-size: 0.24rem;margin-right: 0.2rem;width: 19%;}
        .dotm_btn1{background-color: #fea100;}
        label::before{
        background: url(https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/ktkj_check.png) no-repeat;
        background-size: 100% 100%;
    }
    input[type='radio']:checked+label::before{
        background: url(https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/ktkj_checked.png) no-repeat;
        background-size: 100% 100%;
    }
    .wrong{text-align: right;color: #ff1010;margin-right: 0.2rem;font-size: 0.24rem;display: none;}
    </style>
</head>
<body class="body_tj">
<div id="tbh5v0">
    <div class="addressmone">
        <ul style="margin-bottom: 1rem;">
            <li>请家长填写以下信息以便我们后期寄出</li>
            <li>
                <span>收件人姓名 <i>*</i></span>
                <em>
                    <input type="text" name="parent_name" value="" id="parent_name" style="text-indent: 0.7rem!important;" >
                  <img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_03.png"/>
                </em>
            </li>
            <li style="position: relative;">
                <span>联系电话 <i>*</i></span>
                <em>
                    <input style="width: 98%;height: 0.7rem;" type="number" pattern="[0-9]*" name="" id="phone" value="" />
                    <img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_11.png"/>
                </em>
                <em style="margin-top: 0.1rem;">
                    <input style="width: 60%;height: 0.7rem;" type="number" name="" id="yzm" pattern="[0-9]*" value="" />
                    <img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_14.png"/>
                    <div class="huoqu" style="background-color: #fea100;">获取验证码</div>
                </em>
            </li>
            <li style="margin-bottom: 0;">
                <span>所在地区 <i>*</i></span>
                <div id="trigger4" class="trigger4" style="text-indent:0.5em;display: inline-block;border: 1px solid #ccc;width: 97%;height: 35px;line-height: 35px;font-size: 12px;border-radius: 5px;">
                    <span style="font-size: 12px;color: #666;">请选择省市区县</span>
                </div>

                <input type="hidden" name="" id="sheng" value="" />
                <input type="hidden" name="" id="shi" value="" />
                <input type="hidden" name="" id="xian" value="" />
            </li>
            <li>
                <span>详细地址 <i>*</i></span><em> <textarea name="address" id="address_"></textarea></em>

            </li>
            <li>
                <span>孩子姓名 <i>*</i></span>
                <em>
                    <input type="text" name="student_name" value="" id="student_name" >
                    <img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_03.png"/>
                </em>
            </li>
            <li>
                <span>孩子学校 <i>*</i></span>
                <em>
                    <input type="text" name="grade" value="" id="grade" style="text-indent: 0.7rem!important;">
                    <img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_01.png"/>
                </em>
            </li>
            <li>
                <span>教材版本</span>
                <em>
                    <p>
                      <input type="radio" name="gender" id="gender1" value="1" checked />
                      <label for="gender1"><span>全国卷文科</span></label>
                      <input type="radio" name="gender" id="gender2" value="2" />
                      <label for="gender2"><span>全国卷理科</span></label>
                      <input type="radio" name="gender" id="gender5" value="5" />
                      <label for="gender5"><span style="width: 11%;">北京卷</span></label>
                      <input type="radio" name="gender" id="gender6" value="6" />
                      <label for="gender6"><span style="width: 11%;">浙江卷</span></label>
                    </p>
                <p>
                    <input type="radio" name="gender" id="gender3" value="3" />
                      <label for="gender3"><span>江苏卷文科</span></label>
                      <input type="radio" name="gender" id="gender4" value="4" />
                      <label for="gender4"><span>江苏卷理科</span></label>
                      <input type="radio" name="gender" id="gender7" value="7" />
                      <label for="gender7"><span>新高考卷</span></label>
                </p>   
                </em>
            </li>
            <li style="position: relative;">
                <span>请填写提分宝典的合同号<br />（忘记合同号的家长可以联系群内管理员进行查询）</span>
                <em>
                    <input type="number" pattern="[0-9]*" name="" id="contract" value="" />
                    <img src="https://tmall.fc62.com/mobile/themesmobile/68ecshopcom_mobile/images/student_02.png"/>
                </em>
                <p class="wrong">*合同号错误，请重新核对</p>
            </li>
        </ul>
    
        <!--<div class="dotm_btn">-->
            <input type="submit" value="纸质版领取需自付{$site.guessing_price}元" class="dotm_btn1">
        <!--</div>-->

    </div>
</div>
</body>
<script type="text/javascript" charset="utf-8">
  wx.config({$jssdk});
</script>
<script>
    var type = {$row['id']};
  $(function(){
    var mobileSelect4 = new MobileSelect({
      trigger: '#trigger4',
      title: '地区选择',
      wheels: [{data:[
          {
            id:'1',
            value:'',
            childs:[
              {id:'A1',value:''},
            ]
          }
        ]}],
      transitionEnd:function(indexArr, data){

      },
      callback:function(indexArr, data){
        console.log(data);
        $('#sheng').val(data[0].id);
        $('#shi').val(data[1].id);
        $('#xian').val(data[2].id);
      }
    });
    $.ajax({
      type: "get",
      url: "/api/ajax/area",
      dataType: "json",
      success: function(res){
        mobileSelect4.updateWheels(res.data);
      }
    });
    $('.huoqu').click(function() {
      var tel = $('#phone').val();
      var contract = $('#contract').val();
      if(!(/^1[3456789]\d{9}$/.test(tel))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      $.ajax({
        type: 'post',
        url:"/api/sms/send" ,
        data:{mobile:tel,event:'guessing',action:contract},
        success: function(data){
          console.log(data);
          if(data.code != 1){
            layer.open({
              content:data.msg ,
              skin: 'msg',
              time: 2 //2秒后自动关闭
            });
            return false
          }else{
            var count = 120;
            const countDown = setInterval(() => {
              if (count === 0) {
                $('.huoqu').text('重新发送').removeAttr('disabled');
                $('.huoqu').css({
                  background: '#f3494c',
                  color: '#fff',
                });
                clearInterval(countDown);
              } else {
                $('.huoqu').attr('disabled', true);
                $('.huoqu').css({
                  background: '#eee',
                  color: '#333',
                });
                $('.huoqu').text(count + '秒后可重新获取');
              }
              count--;
            }, 1000);
          }
        }
      });
    });

    $('.dotm_btn1').click(function(){
      var name = $('#parent_name').val();
      var address = $('#address_').val();
      var tel = $('#phone').val();
      var code = $('#yzm').val();
      var sheng = $('#sheng').val();
      var shi = $('#shi').val();
      var xian = $('#xian').val();
      var banben = $('input[name="gender"]:checked').val();
      var children_name = $('#student_name').val();
      var children_school = $('#grade').val();
      var contract = $('#contract').val();
      if(name == ""||name == null){
        layer.open({
          content: '请填写姓名',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
         $("#parent_name").focus();
        return false;
      }

      if(!(/^1[3456789]\d{9}$/.test(tel))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#phone").focus();
        return false;
      }
      if(code == ""||code == null){
        layer.open({
          content: '请填写验证码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#yzm").focus();
        return false;
      }
      if(sheng == ""||sheng == null){
        layer.open({
          content: '请选择所在地区',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
          $("#sheng").focus();
        return false;
      }
      if(address == ""||address == null){
        layer.open({
          content: '请填写详细地址',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#address_").focus();
        return false;
      }
      if(children_name == ""||children_name == null){
        layer.open({
          content: '请填写孩子姓名',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#student_name").focus();
        return false;
      }
      if(children_school == ""||children_school == null){
        layer.open({
          content: '请填写孩子学校',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#grade").focus();
        return false;
      }
       if(banben == 0){
        layer.open({
          content: '请选择领取版本',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#gender1").focus();
        return false;
      } 
      if(contract == ""||contract == null){
        layer.open({
          content: '请填写合同',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        $("#contract").focus();
        return false;
      }
     

       $.ajax({
        type: 'post',
        url:"https://2020.fc62.com/bbs/app.php?m=mem&c=order_hetong",
        data:{hetong:contract},
        dataType: "json",
        success: function(data){
          console.log(data);
          console.log(data.status);
            if(data.status == 2){
                layer.open({
                  content: data.msg,
                  skin: 'msg',
                  time: 2,
                });
               return false;
            }else if(data.status == 1){
               //验证验证码
                $.ajax({
                  type: 'post',
                  url:"/api/sms/check" ,
                  data:{mobile:tel,captcha:code,event:'guessing'},
                  success: function(data){
                    if(data.code == 0){
                      layer.open({
                        content: data.msg,
                        skin: 'msg',
                        time: 2,
                      });
                      return false;
                    }else{
                      //添加禁止标签
                      $('.dotm_btn1').attr("disabled","disabled");
                      $.ajax({
                        type: 'post',
                        url:"/api/ques/guessing" ,
                        data:{name:name,phone:tel,address:address,shen:sheng,shi:shi,xian:xian,version:banben,children_name:children_name,children_school:children_school,contract:contract,source:type},
                        success: function(data){
                          if(data.code != 0){
                            wx.chooseWXPay({
                              timestamp: data.data.timeStamp,
                              nonceStr: data.data.nonceStr,
                              package: data.data.package,
                              signType: data.data.signType,
                              paySign: data.data.paySign, // 支付签名
                              success: function (res) {
                              // 支付成功后的回调函数
                                if (res.errMsg == "chooseWXPay:ok") {
                                  // alert('支付成功');
                                  window.location.href="https://tmall.fc62.com/ktkj_zfsuccess.html?num={$site.guessing_price}";
                                  // window.location.reload();
                                  $('.dotm_btn1').removeAttr("disabled");
                                } else {
                                  alert(res.errMsg,null);
                                  $('.dotm_btn1').removeAttr("disabled");
                                }
                              },
                              cancel: function(r) {
                                alert('取消支付');
                                $('.dotm_btn1').removeAttr("disabled");
                              },
                              fail:function(r){
                                alert('fail支付失败了');
                                $('.dotm_btn1').removeAttr("disabled");
                                //支付失败
                              }

                          });

                          }else{
                            layer.open({
                              content: data.msg,
                              skin: 'msg',
                              time: 2, //2秒后自动关闭
                            });
                            $('.dotm_btn1').removeAttr("disabled");
                          }

                        }
                      });
                    }
                  }
                });
            }
          } 
        });
     
      
   });
  });




</script>
</html>